package com.crm.controller;

import com.crm.base.ResponseResult;
import com.crm.domain.dto.BuesinessStaticsQueryDto;
import com.crm.domain.vo.BusinessChangeVO;
import com.crm.domain.vo.BusinessCountVo;
import com.crm.service.IndexService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/index")
@Api(tags = "首页")
public class IndexController {
    @Autowired
    private IndexService indexService;

    @GetMapping()
    @ApiOperation("基础首页数据")
    public ResponseResult<BusinessCountVo> countByTime(BuesinessStaticsQueryDto buesinessStaticsQueryDto){
        BusinessCountVo businessCountVo = new BusinessCountVo();
        return ResponseResult.success(businessCountVo);
    }

    @GetMapping("/businessChangeStatistics")
    @ApiOperation("商机转换变化统计")
    public ResponseResult<List<BusinessChangeVO>> businessChangeStatistics(BuesinessStaticsQueryDto buesinessStaticsQueryDto){
        List<BusinessChangeVO> list = indexService.businessChangeStatistics(buesinessStaticsQueryDto);
        return ResponseResult.success(list);
    }

    @GetMapping("/salesStatistic")
    @ApiOperation("商机转换变化统计")
    public ResponseResult<List<BusinessChangeVO>> salesStatistic(BuesinessStaticsQueryDto buesinessStaticsQueryDto){
        List<BusinessChangeVO> list = indexService.salesStatistic(buesinessStaticsQueryDto);
        return ResponseResult.success(list);
    }
}
